/**
 * ClassName: Constants.java
 * created on 2013-1-24
 * Copyrights 2013-1-24 hjgang All rights reserved.
 * site: http://t.qq.com/hjgang2012
 * email: hjgang@yahoo.cn
 */
package com.meihua.baoleyi.common;

import android.content.Context;
import android.os.Environment;

import java.io.File;

/**
 * @author liminig
 * @category 全局变量
 * @日期 2017-10-16
 * @时间 下午2:05:25
 * @年份 2017
 */
public final class Constants {
    /**
     * 系统初始化配置文件名
     */
    public static final String SYSTEM_INIT_FILE_NAME = "handongkeji.android.sysini";
    public static final String FLAG = "com.handongkeji.android";

    /**
     * 判断是否从MainActivity进入登录
     */
    public static final String FIRST_LOGIN = "first_login";
    public static final String FIRST_LOGIN_FLAG = "first_login_flag";

    // regist/userinfo.json?
    /**
     * 微信支付Appid
     */
    public static final String APP_ID = "wxbe55fe290582e46b";
    /**
     * 微信支付Appkey
     */
    public static final String APP_KEY = "88888888888888888888888888888888";
    /**
     * QQ ID
     */
    public static final String QQ_ID = "1105790097";
    /**
     * QQ KEY
     */
    public static final String QQ_KEY = "8GeB7NBWPuEtvWsw";
    /**
     * 微信 ID
     */
    public static final String WX_ID = "wx229132cf3f813d95";
    /**
     * 微信 KEY
     */
    public static final String WX_SECRET = "76915a77c826b8778c48a437c2c9f4f0";

    /**
     * 用于标识请求照相功能的activity结果码
     */
    public static final int RESULT_CODE_CAMERA = 1;
    /**
     * 用来标识请求相册gallery的activity结果码
     */
    public static final int RESULT_CODE_PHOTO_PICKED = 2;
    public static final int RESULT_CODE_PHOTO_CUT = 3;
    /**
     * 用于识别帖子界面ListView
     */
    public static final int LIST_TOP = 1001;
    public static final int LIST_BOTTOM = 1002;
    /**
     * 图片类型
     */
    public static final String IMAGE_UNSPECIFIED = "image/*";
    /**
     * 本地缓存目录
     */
    public static String CACHE_DIR;
    /**
     * 图片缓存目录
     */
    public static String CACHE_DIR_IMAGE;
    /**
     * 待上传图片缓存目录
     */
    public static String CACHE_DIR_UPLOADING_IMG;
    /**
     * 图片目录
     */
    public static String CACHE_IMAGE;
    /**
     * 图片名称
     */
    public static final String PHOTO_PATH = "handongkeji_android_photo";
    /**
     * 语音缓存目录
     */
    public static String CACHE_VOICE;

    public static void init(Context context){
        if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) {
            CACHE_DIR = context.getExternalCacheDir().getAbsolutePath();
        }else{
            CACHE_DIR = context.getCacheDir().getAbsolutePath();
        }
        File file = new File(CACHE_DIR,"image");
        file.mkdirs();
        CACHE_IMAGE = file.getAbsolutePath();
        CACHE_DIR_IMAGE = CACHE_IMAGE;
        file = new File(CACHE_DIR,"temp");
        file.mkdirs();
        CACHE_DIR_UPLOADING_IMG = file.getAbsolutePath();
        file = new File(CACHE_DIR,"voice");
        file.mkdirs();
        CACHE_VOICE = file.getAbsolutePath();

        file = new File(CACHE_DIR,"html");
        file.mkdirs();
        ENVIROMENT_DIR_CACHE = file.getAbsolutePath();
    }

//    static {
//        if (Environment.MEDIA_MOUNTED.equals(Environment
//                .getExternalStorageState())) {
//            CACHE_DIR = Environment.getExternalStorageDirectory()
//                    .getAbsolutePath() + "/handongkeji.android/";
//        } else {
//            CACHE_DIR = Environment.getRootDirectory().getAbsolutePath()
//                    + "/handongkeji.android/";
//        }
//
//        CACHE_IMAGE = CACHE_DIR + "/image";
//        CACHE_DIR_IMAGE = CACHE_DIR + "/pic";
//        CACHE_DIR_UPLOADING_IMG = CACHE_DIR + "/uploading_img";
//        CACHE_VOICE = CACHE_DIR + "/voice/";
//    }

    public static String ENVIROMENT_DIR_CACHE = CACHE_DIR + "/cache/";

    private Constants() {
    }

    /**
     * 数据库版本号
     */
    public static final int DB_VERSION = 1;
    /**
     * 数据库名
     */
    public static final String DB_NAME = "android.db";
    /**
     * 与服务器端连接的协议名
     */
    public static final String PROTOCOL = "http://";
    /**
     * 服务器IP
     */
    public static final String HOST = "handongkeji.com";
    public static final String HOST2 = "handongkeji.com";

    /**
     * 服务器端口号
     */
    public static final String PORT = ":8090/youqinpinche/";
    public static final String PORT2 = ":8090/";
    /**
     * 应用上下文完整路径
     *
     */
//	public static final String URL_CONTEXTPATH = PROTOCOL + HOST2 + PORT;
//	public static final String URL_CONTEXTPATH = "http://appcdn.youqin168.com/youqinpinche/";
//    //picapp.youqin168.com  上传图片的地址
//    public static final String URL_CONTEXTPATH1 = "http://app.youqin168.com/youqinpinche/";
//	public static final String URL_CONTEXTPATH = "http://192.168.1.129/rt/r";
    public static final String URL_CONTEXTPATH = "http://rtbus.koushiw.com/rt/r"; //  文立飞 保存订单乘客车主反传
//    public static final String URL_SEEHEAD="http://192.168.1.129/rt/upload/"; //查看图片加的前缀
    public static final String URL_SEEHEAD="http://rtbus.koushiw.com/rt/upload/"; //查看图片加的前缀
    /**
     * 应用图片完整路径
     */
    public static final String URL_CONTEXTPATH_PIC = PROTOCOL + HOST2 + PORT2;
    /**
     * 应用图片完整路径2
     *
     */
    public static final String URL_CONTEXTPATH_PIC2 = PROTOCOL + HOST + PORT2;

    /**
     * 获取广告
     **/
    public static final String URL_GET_AD = URL_CONTEXTPATH
            + "sysAd/getAdList.json";

    /**
     * 获取用户信息
     **/
    public static final String URL_GET_USERINFO = URL_CONTEXTPATH
            + "mbuser/getUserInfo.json";
    /**
     * 上传图片接口
     **/
    public static final String URL_UPLOAD = URL_CONTEXTPATH
            + "tool/uploadAPI.json";
    /**
     * 上传语音接口
     */
    public static final String URL_UPLOADAUDIO = URL_CONTEXTPATH
            + "tool/uploadAudio.json";

    /**
     * 3.1.1	注册获取手机验证码
     */
    public static final String URL_GETVERIFYCODE = URL_CONTEXTPATH + "mbUserPer/getCode.json";

    /**
     * 3.1.21	登录获取手机验证码
     */
    public static final String URL_VERIFYCODE_SIGNIN = URL_CONTEXTPATH+"mbUserPer/code.json";
    /**
     * 验证验证码
     */
    public static final String URL_REG_GETCODE = URL_CONTEXTPATH + "mbUserPer/checkCode.json";
    /**
     * 版本更新autoUpdate/getVersion.json
     */
    public static final String URL_VERSIONUPDATE = URL_CONTEXTPATH+"autoUpdate/getVersion.json?configtype=1";


}
